<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.Date" %>
<%@page import="java.text.SimpleDateFormat" %>
<%@taglib uri="/roomUtil"  prefix="roomUtil"%>
<%@taglib uri="/adminUtil"  prefix="adminUtil"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:if test="${empty requestScope.checkIns }">
	<center><h1>没有入住信息</h1></center>
</c:if>
<c:if test="${!empty requestScope.checkIns }">
	<div role="tabpanel" class="tab-pane active" id="sour">
		<div class="check-div form-inline">
			<br><br>
		</div>
		<div class="data-div">
			<div class="row tableHeader">
				<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
					房间名称
				</div>
				<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
					处理人
				</div>
				<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
					旅客联系方式
				</div>
				<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
					入住时间
				</div>
				<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
					退房时间
				</div>
				<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
					收费
				</div>
				<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
					操作
				</div>
			</div>
			<div class="tablebody">
				<div id="collapseAccount" class="collapse in" aria-expanded="true">
					<c:forEach items="${requestScope.checkIns }" var="checkIn">
						<div class="row">
							<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 levl1 ">${roomUtil:getRoomName(checkIn.roomId)}
							</div>
							<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 levl1 ">${adminUtil:getAdminName(checkIn.adminId)}
							</div>
							<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 levl1 ">${checkIn.phone }
							</div>
							<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 levl1 ">${checkIn.inTime } 	
							</div>
							<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 levl1 ">${checkIn.outTime } 	
							</div>
							<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 levl1">
								${checkIn.cost }
							</div>
							<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
								<button class="btn btn-warning btn-xs" data-toggle="modal" data-target="" onclick="leaveRoom(${checkIn.id})">退房</button>
								<button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#deleteSource" onclick="jump('/hotel/changeRoom/changePage?id=${checkIn.id}')">换房</button>
								<button class="btn btn-success btn-xs" data-toggle="modal" data-target="#deleteSource" onclick="jump('/hotel/continueBook/continuePage?id=${checkIn.id}')">续住</button>
							</div>
						</div>
					</c:forEach>
				</div>
			</div>
		</div>
	</div>
</c:if>
<!--页码块-->
<center>
	<a class="btn btn-xs btn-xs btn-green" onclick='jump("/hotel/checkIn//checkInList?page=1")'>#首页
	</a>
	<a class="btn btn-xs btn-xs btn-green" onclick='jump("/hotel/checkIn//checkInList?page=${currentPage==1?1:currentPage-1}")'>&lt;上一页
	</a>
	<a class="btn btn-xs btn-xs btn-green" onclick='jump("/hotel/checkIn//checkInList?page=${currentPage+1}")'>下一页&gt;
	</a>
</center>
<script src="/hotel/js/jumpUtil.js"></script>		
<script>
function leaveRoom(id){
	$.post("/hotel/checkIn/leaveRoomConfirm",{id:id},function(str){
		//alert(str)
		var res=eval('(' +str + ')')
		if(res.code!=0){
			alert(res.message)
			//refreshTypeList()
			return;
		}else{
			res=res.object
			cho=confirm('当前时间为'+res.curOutTime+'\n预计退房时间为'+res.oriOutTime+'\n要'+(res.price>0?'补收'+res.price:'退回'+(-res.price))+'元\n是否退房？');
			if(cho){	//如果确定要退房
				$.post("/hotel/checkIn/leaveRoom",{id:res.id},function(str){
					//alert(str)
					var res=eval('(' +str + ')')
					if(res.code!=0){
						alert(res.message)
						return;
					}else{
						window.location.href="/hotel/system/mainPage"
					}
				})
			}
		}
	})
}


</script>



